import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int[] arr=new int[N];
        for (int i=0;i< arr.length;i++){
            arr[i]= sc.nextInt();
        }
        boolean s=delight(arr);
        System.out.println(s);
    }
    public static boolean delight(int[] arr){
        int flag=0;
        for(int i=0;i<arr.length;i++){
            if(arr[i]%2!=0){
                flag++;
            }
            else{
                flag=0;
            }
            if(flag==3){
                return true;
            }
        }
        return false;
    }
    public static void main5(String[] args) {
        int[] arr={1,1,1,1,1,5,4,5,3};
        Arrays.sort(arr);
        System.out.println(arr[arr.length/2]);
    }
    public static void main4(String[] args) {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int[] arr=new int[N];
        for (int i=0;i< arr.length;i++){
            arr[i]= sc.nextInt();
        }
        int sum=0;
        for(int n:arr){
            sum^=n;
        }
        System.out.println(sum);
    }
    public static void main3(String[] args) {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int[] arr=new int[N];
        for (int i=0;i< arr.length;i++){
            arr[i]= sc.nextInt();
        }
        int target= sc.nextInt();
        int[] sum=twoSum(arr,target);
        System.out.println(Arrays.toString(sum));
        /*Popsort(arr);
        for (int i=0;i< arr.length;++i){
            System.out.print(arr[i]+" ");
        }*/
        /*int target= sc.nextInt();
        int Index=Indexsearch(arr,target);
        System.out.println(Index);*/
    }
    public static int[] twoSum(int[] nums,int target){
        int[] sum=new int[2];
        for(int i=0;i<nums.length;++i){
            for(int j=i+1;j<nums.length;++j){
                if(nums[i]+nums[j]==target){
                    sum[0]=i;
                    sum[1]=j;
                }
            }
        }
        return sum;
    }
    public static void Popsort(int[] arr){
        for(int i=0;i<arr.length-1;++i){
            for(int j=i+1;j< arr.length;++j){
                if(arr[i]>arr[j]){
                    int a=arr[i];
                    arr[i]=arr[j];
                    arr[j]=a;
                }
            }
        }
    }
    public static int Indexsearch(int[] arr,int target){
        int left=0,right= arr.length-1;
        while (left<=right){
            int mid=left+(right-left)/2;
            if(arr[mid]==target){
                return mid;
            }
            else if(arr[mid]<target){
                left=mid+1;
            }
            else{
                right=mid-1;
            }
        }
        return -1;
    }
    public static void main2(String[] args) {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int[] arr=new int[N];
        for (int i=0;i< arr.length;i++){
            arr[i]= sc.nextInt();
        }
        int left=0,right= arr.length-1;
        while (left< arr.length){
            if(arr[left]%2!=0){
                left++;
            }
            else{
                while (arr[right]%2==0&&right!=left){
                    right--;
                }
                if(right==left){
                    break;
                }
                reverse(arr,left,right);
            }
        }
        for (int i=0;i< arr.length;i++){
            System.out.print(arr[i]+" ");
        }
    }
    public static void reverse(int[] arr,int left,int right){
        int a=arr[left];
        arr[left]=arr[right];
        arr[right]=a;
    }
    public static void main1(String[] args) {
        Scanner sc=new Scanner(System.in);
        int[] arr1=new int[3];
        for(int i=0;i< arr1.length;++i){
            arr1[i]= sc.nextInt();
        }
        transform(arr1);
    }
    public static void transform(int[] arr1){
        for(int i=0;i< arr1.length;++i){
            arr1[i]*=2;
            System.out.print(arr1[i]+" ");
        }
    }
}